const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect("mongodb://localhost/graproject", { useNewUrlParser: true })

//评论表

var fromSchema = new Schema({
    
    wcommitId: {// 文章的id
        type: String,
        required: true
    },
    from_id:{//根据该id查找所有的回复
        type: String,
        required: true
    },
    from_img:{//评论用户的头像
        type: String,
        required: true
    },
   
    from_name:{//评论用户的用户名
        type: String,
        required: true
    },
    content: {//评论内容
        type: String,
        required: true
    },

    from_like: {//点赞数量
        type: Number,
        required: true
    },

    from_oppose: {//反对数量
        type: Number,
        required: true
    }
})

module.exports = mongoose.model('fromCommit', fromSchema)